OS X开发:NSProgressIndicator进度指示器控件
NSProgressIndicator是OS X平台上的活动指示器控件,开发者可以设置圆环样式和进度条样式两种。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| - (void)viewDidLoad { [super viewDidLoad]; NSProgressIndicator * progressIndicator = [[NSProgressIndicator alloc]initWithFrame:CGRectMake(30, 100, 200, 10)]; progressIndicator.indeterminate = YES; progressIndicator.bezeled = YES; progressIndicator.controlSize = NSControlSizeSmall; progressIndicator.doubleValue = 5; progressIndicator.style = NSProgressIndicatorBarStyle; progressIndicator.displayedWhenStopped = YES; [self.view addSubview:progressIndicator]; }
|
效果如图:
NSProgressIndicator类中属性方法解析如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
| @property (getter=isIndeterminate) BOOL indeterminate;
@property (getter=isBezeled) BOOL bezeled;
@property NSControlTint controlTint;
@property NSControlSize controlSize;
@property double doubleValue;
- (void)incrementBy:(double)delta;
@property double minValue;
@property double maxValue;
@property BOOL usesThreadedAnimation;
- (void)startAnimation:(nullable id)sender;
- (void)stopAnimation:(nullable id)sender;
@property NSProgressIndicatorStyle style;
@property (getter=isDisplayedWhenStopped) BOOL displayedWhenStopped;
|